#include <signal.h>     //signal
#include <iostream>
#include <unistd.h>     //sleep
using namespace std;

using sighandler_t = void(*)(int);
int main() {
    signal(SIGINT, [](int sigNO) -> void{        //只需要设置一次，往后都有效
        cout << "get signal: " << sigNO << endl; 
        exit(1);
    });
    while(1) {
        cout << "i am a process" << endl;
        sleep(1);
    }
}